<!--
 * @Descripttion: 
 * @Version: 
 * @Author: gaohj
 * @Date: 2022-11-02 09:32:57
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-11-02 09:46:58
-->
<!-- <!DOCTYPE html> -->
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            width:6666px;
            height:6666px;
        }
    </style>
</head>
<body>
    <script>
        // 也有人叫滚动条的定位

        // document.documentElement.scrollTop()
        window.onscroll = function(){
            // 卷去的高度  滚动条距离上面的距离 
            // 有<!DOCTYPE html>
            // var res = document.documentElement.scrollTop; // 
            // console.log(res);
            // 无<!DOCTYPE html>
            // var res1 = document.body.scrollTop;
            // console.log(res1);
            // var res = document.documentElement.scrollTop|| document.body.scrollTop;
            // console.log(res);


            // 卷去的宽度  
            // var res = document.documentElement.scrollLeft|| document.body.scrollLeft;
            // console.log(res);
        }

    </script>
</body>
</html>